import request from '@/utils/request';

/**
 * @url http://172.16.6.103:9005/project/71/interface/api/51868
 */
export async function insertFeedback({ bugDesc, frontTitle, frontUrl, screenFiles }) {
    return request('/api/oa/v1/sysbugreport/insert', {
        data: { bugDesc, frontTitle, frontUrl, screenFiles },
        method: 'POST'
    });
}

/**
 * @url http://172.16.6.103:9005/project/71/interface/api/51886
 */
export async function updateFeedback(param) {
    return request('/api/oa/v1/sysbugreport/update', {
        data: param,
        method: 'POST'
    });
}

/**
 * 查询问题反馈分页列表（企业端）
 * @param bugStatuses bug状态列表;待办、测试进行中、研发进行中、产品进行中、测试已完成、研发已完成、产品已完成、研发完成无需测试、完成
 * @param createUser 创建用户
 * @param jirano jira编号
 * @param orderBy 搜索排序字段,按反馈时间排序sbr.create_time
 * @param searchName 搜索字段
 * @param updateUser 更新用户
 * @param pageNo 页码：按需传参
 * @param pageSize 每页记录数：按需传参
 * @returns {Promise<unknown>}
 */
export async function fetchFeedbackList({
    bugStatuses,
    createUser,
    jirano,
    orderBy,
    searchName,
    updateUser,
    pageNo,
    pageSize
}) {
    return request('/api/oa/v1/sysbugreport/list', {
        data: { bugStatuses, createUser, jirano, orderBy, searchName, updateUser, pageNo, pageSize },
        method: 'POST'
    });
}

/**
 * @url http://172.16.6.103:9005/project/71/interface/api/51877
 */
export async function fetchOwnerFeedbackList(param) {
    return request('/api/oa/v1/sysbugreport/personnallist', {
        data: param,
        method: 'POST'
    });
}

/**
 * @url http://172.16.6.103:9005/project/71/interface/api/51895
 */
export async function fetchOneFeedback(id) {
    return request(`/api/oa/v1/sysbugreport/${id}`, {
        method: 'GET'
    });
}

/**
 * 查询对应jira评论
 * @param jirano jira编号
 * @returns {Promise<unknown>}
 */
export async function fetchJIRA(jirano) {
    return request(`/api/oa/v1/sysbugreport/jiracomments?jirano=${jirano}`, {
        method: 'GET'
    });
}
